import Cookie from 'js-cookie'

export default {
    state: {
        isCollapse: false,  //是否折叠
        menuContent: '数据导入',
    },
    mutations: {
        // 修改菜单展开收起的方法
        collapseMenu(state) {
            state.isCollapse = !state.isCollapse
        },
        // 设置标签信息
        setMenu(state, val) {
            state.menuContent = val.label

            Cookie.set('menuContent', val.label, { expires: 1 })
        },
        // 在页面加载时从本地存储中获取标签信息
        initMenu(state) {
            const menuContent = Cookie.get('menuContent')
            if (menuContent) {
                state.menuContent = menuContent
            }
        },
    }
}